package com.carrot.system.service.impl;

import com.carrot.common.core.domain.entity.SysPointHistoryMap;
import com.carrot.common.core.domain.entity.SysPointStandardField;
import com.carrot.common.exception.ServiceException;
import com.carrot.common.mybatis.BaseServiceImpl;
import com.carrot.system.mapper.SysPointHistoryMapMapper;
import com.carrot.system.service.ISysPointHistoryMapService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysPointHistoryMapServiceImpl extends BaseServiceImpl<SysPointHistoryMapMapper, SysPointHistoryMap>
        implements ISysPointHistoryMapService {

    @Resource
    private SysPointHistoryMapMapper historyMapMapper;

    /**
     * 匹配map_field
     */
    @Override
    public List<SysPointStandardField> getStandardField(String equipmentType, String description) {

//        List<SysPointStandardField> list =  historyMapMapper.getStandardField(equipmentType,description);

        return historyMapMapper.getStandardField(equipmentType,description);
    }

    @Override
    @Transactional(rollbackFor = ServiceException.class)
    public void add(SysPointHistoryMap pointHistoryMap) {

        this.save(pointHistoryMap);
    }

    @Override
    @Transactional(rollbackFor = ServiceException.class)
    public void update(SysPointHistoryMap pointHistoryMap) {

        this.updateById(pointHistoryMap);
    }

    @Override
    @Transactional(rollbackFor = ServiceException.class)
    public void del(Long id) {
        this.removeById(id);
    }

    @Override
    @Transactional(rollbackFor = ServiceException.class)
    public void batchDel(List<Long> ids) {

        this.removeBatchByIds(ids);
    }
}
